﻿using ICSharpCode.SharpZipLib.Zip;

namespace ArcEngine.Resources
{
	public class Binary : ResourceBase
	{
		public Binary(string name) : base(name)
		{

		}

		#region IO routines

		
		///
		///<summary>
		/// Save the collection to the bank
		/// </summary>
		/// <param name="zip"></param>
		public bool Save(ZipOutputStream zip)
		{
			ResourceManager.SaveResource(zip, "Binaries/" + this.Name, this.Data);
			return true;
		}

		/// <summary>
		/// Opens a file
		/// </summary>
		/// <param name="name"></param>
		/// <returns></returns>
		public bool LoadFile(string name)
		{
			Data = ResourceManager.OpenResource(name);

			if (Data != null)
				return true;
			else
				return false;
		}


		#endregion


		#region Variables
		/// <summary>
		/// Datas of the resource
		/// </summary>
		public byte[] Data;

		#endregion
	}
}
